<?php 
defined('_JEXEC') or die('Restricted access'); 
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$user =& JFactory::getUser();
//Ordering allowed ?
$lists = $this->lists;
$rows = $this->items;

$page = $this->pageNav;
$ordering = ($lists['filter_order'] == 'c.ordering');
JHTML::_('behavior.tooltip');

?>
<form action="index.php" method="post" name="adminForm" class="content-right">
	<table width="100%">
	<tr>
	
		<td valign="top">
			<table>
	
				<tr>
					<td align="left" width="100%">
						<?php echo JText::_( 'Filter' ); ?>:
							<input type="text" name="search" id="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
							<button onclick="this.form.submit();"><?php echo JText::_( 'GO' ); ?></button>
							<button onclick="document.getElementById('search').value=''; this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
			</table>
		
	
		    <div style="width:100%;">	
			
			<table class="adminlist">
			<thead>
					<tr>
						<th width="10" align="left">
							<?php echo JText::_( 'NUM' ); ?>
						</th>
						<th width="20">
							<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows);?>);" />
						</th>
						<th class="title">
							<?php echo JHTML::_('grid.sort',   JText::_('Title'), 's.title', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="5%">
							<?php echo JHTML::_('grid.sort',   JText::_('Credits'), 's.value', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="15%">
							<?php echo JHTML::_('grid.sort',   JText::_('Price'), 's.price', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="5%" nowrap="nowrap">
							<?php echo JHTML::_('grid.sort',   JText::_('Publish'), 's.published', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="13">
						<?php echo $page->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
				<tbody>
					<?php
					$k = 0;
					for ($i=0, $n=count( $rows ); $i < $n; $i++)
					{
						$row = $rows[$i];
						$checked 	= JHTML::_('grid.id',   $i, $row->id );
						//$link 		= JRoute::_( 'index.php?option=com_hello&controller=hello&task=edit&cid[]='. $row->id );
						JFilterOutput::objectHtmlSafe($row);
				
							$row->sect_link = JRoute::_( "index.php?option={$lists['option']}&task=edit&cid[]=$row->id" );
				
							$link = "index.php?option={$lists['option']}&view=jacredits&task=edit&cid[]=$row->id" ;
							$published 	= JHTML::_('grid.published', $row, $i );
						?>
						<tr class="<?php echo "row$k"; ?>">
								<td>
									<?php echo $page->getRowOffset( $i ); ?>
								</td>
								<td>
									<?php echo $checked; ?>
								</td>
								<td>
									<span class="editlinktip hasTip" title="<?php echo JText::_( 'TITLE' );?>::<?php echo $row->title; ?>">
									
										<a href="<?php echo JRoute::_( $link ); ?>">
											<?php echo $row->title; ?></a>
										</span>
								</td>
								<td align="center">
									<?php echo $row->value; ?>
								</td>								
								<td align="center">
									<?php echo $row->price;?>
								</td>
								<td align="center">
									<?php echo $published;?>
								</td>

							</tr>
						<?php
						$k = 1 - $k;
					}
					?>
				</tbody>
			</table>
		</div>
		</td>
	</tr>
	</table>
<input type="hidden" name="filter_order" value="<?php echo $lists['filter_order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['filter_order_Dir']; ?>" />
<input type="hidden" name="option" value="<?php echo $lists['option']; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="view" value="jacredits" />
</form>

